// 校验色
$validate-color-map: (
  "success": $success-color,
  "info": $info-color,
  "warn": $text-warn-color,
  "error": $danger-color,
);

%default-padding {
  padding: 0 ($base-gap-of-x / 2); // 保证之间的间隙是基础间隙
}

@mixin form-item-height($height) {
  .br-form-help,
  .br-form-label {
    line-height: $height;
  }
}

@mixin form-item-extends-size {
  @each $tag, $height in $input-height-map {
    &--#{$tag} {
      @include form-item-height($height)
    }
  }
}

// 表单label
.br-form-label {
  display: block;
  @extend %default-padding;
}

// 用于包裹输入控件
.br-form-control {
  @extend %default-padding;
}

// 表单提示信息
.br-form-help {
  @extend %default-padding;

  @each $tag, $color in $validate-color-map {
    &--#{$tag} {
      color: $color;
    }
  }

  &--with-icon {
    position: relative;
  }

  &--with-icon &__content {
    margin-left: 20px;
  }

  &__icon {
    position: absolute;
  }
}

// 默认高度
@include form-item-height($md-input-height);

// 表单组
.br-form-group {
  margin-bottom: $base-gap-of-y;

  // 可以通过.br-form-group来控制label/help的高度
  @include form-item-extends-size();

  @each $tag, $color in $validate-color-map {
    &--#{$tag} .br-form-help {
      color: $color;
    }
  }
}


